package top.laoshuzi.common.base;

import android.app.Application;
import android.content.Context;
import android.support.multidex.MultiDex;

import com.alibaba.android.arouter.launcher.ARouter;
import com.blankj.utilcode.util.AppUtils;
import com.blankj.utilcode.util.LogUtils;
import com.blankj.utilcode.util.Utils;
import com.coorchice.library.ImageEngine;

import top.laoshuzi.common.ui.engine.GlideEngine;

/**
 * Created by mouse on 2018/1/22.
 */

public class CommonApplication extends Application {

    @Override
    public void onCreate() {
        super.onCreate();

        Utils.init(this);

        //路由
        if (AppUtils.isAppDebug()) {
            ARouter.openDebug();
            ARouter.openLog();
        }
        ARouter.init(this);

        //日志
        if (AppUtils.isAppDebug()) {
            LogUtils.getConfig()
                    .setLogSwitch(true)
                    .setGlobalTag(AppUtils.getAppName());
        } else {
            LogUtils.getConfig()
                    .setLogSwitch(false);
        }
        System.out.println(AppUtils.getAppName());

        ImageEngine.install(new GlideEngine(this));

    }

    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(this);
    }

}
